<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:a4j="http://richfaces.org/a4j"
      xmlns:rich="http://richfaces.org/rich"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"> 

<h:head>
	<title>Feedbackmodul</title>
	<link rel="stylesheet" type="text/css" href="../css/styles.css"></link>
	<link rel="stylesheet" type="text/css" href="../css/start.css"></link>
	<meta http-equiv="content-type" content="text/html; charset=utf-8"></meta>
</h:head> 
<body onload="jQuery('#register_form').hide();">
	<a4j:outputPanel styleClass="headerMenu" id="headerMenu">
		<rich:jQuery query="jQuery('#register_form').hide();jQuery('#login_form').fadeIn(700);" event="click" selector="#loginShow_B"></rich:jQuery>
		<rich:jQuery query="jQuery('#login_form').hide();jQuery('#register_form').fadeIn(700);" event="click" selector="#RegisterShow_B"></rich:jQuery>
		<h:form id="headermenueForm">
		<table id="header_table" class="HeaderMenuTable">
			<tr>
				<td><a4j:commandLink id="loginShow_B" value="login"></a4j:commandLink></td>
				<td><a4j:commandLink id="RegisterShow_B" value="register"></a4j:commandLink></td>
				<td><h:commandLink action="#{loginViewBean.gotoSurvey()}"  id="SurveyShow_B" value="zur Umfrage Ecke" target="_blank"></h:commandLink></td>
			</tr>
		</table>
		</h:form>
	</a4j:outputPanel>
	
	<h:form id="login_form">
    <rich:panel styleClass="loginPanel" id="loginPanel">
        <f:facet name="header">
        <center>Login</center>
        </f:facet>
        
        <table id="login_table" class="LoginTable">
        	<tr>
        		<td><h:outputText value="Name: " /> </td>
        		<td><h:inputText id="name_input" value="#{loginViewBean.loginname}"/></td>
        	</tr>
        	<tr>
        		<td><h:outputText value="Passwort: " /> </td>
        		<td><h:inputSecret id="passwort_input" value="#{loginViewBean.loginpasswort}"/></td>
        	</tr>
        	<tr>
        		<td colspan="2"><hr width="90%"/></td>
        	</tr>
        	<tr>
        		<td colspan="2">
        			<center>
        			<a4j:commandButton value="login" onbegin="#{rich:component('Loadingpopup')}.show();" oncomplete="#{rich:component('Loadingpopup')}.hide();" execute="login_form" action="#{loginViewBean.login()}" render="Messagespopup,loginPanel"/>
        			</center>
        		</td>
        	</tr>
        </table>
	</rich:panel>
	</h:form>
	
	<h:form id="register_form">
    <rich:panel styleClass="loginPanel" id="registerPanel">
        <f:facet name="header">
        <center>Register</center>
        </f:facet>
        
        <table id="register_table" class="RegisterTable">
        	<tr>
        		<td><h:outputText value="Name: " /> </td>
        		<td><h:inputText value="#{loginViewBean.registerVorname}" styleClass="normalInput"/></td>
        	</tr>
        	<tr>
        		<td><h:outputText value="Nachname: " /> </td>
        		<td><h:inputText value="#{loginViewBean.registerName}" styleClass="normalInput"/></td>
        	</tr>
        	<tr>
        		<td><h:outputText value="Email: " /> </td>
        		<td><h:inputText value="#{loginViewBean.registerEmail}" styleClass="normalInput"/></td>
        	</tr>
        	<tr>
        		<td><h:outputText value="Passwort: " /> </td>
        		<td><h:inputSecret value="#{loginViewBean.registerPasswort}" styleClass="normalInput"/></td>
        	</tr>
        	<tr>
        		<td><h:outputText value="Passwort wiederholen: "/> </td>
        		<td><h:inputSecret value="#{loginViewBean.registerPasswort2}" styleClass="normalInput"/></td>
        	</tr>
        	<tr>
        		<td><h:outputText value="Rolle: "/> </td>
        		<td>
        			<rich:select value="#{loginViewBean.userRole}">
        				<f:selectItems value="#{loginViewBean.getUserRoles()}"/>
        			</rich:select>
        		</td>
        	</tr>
        	<tr>
        		<td colspan="2"><hr width="90%"/></td>
        	</tr>
        	<tr>
        		<td colspan="2"><center><a4j:commandButton onbegin="#{rich:component('Loadingpopup')}.show();" oncomplete="#{rich:component('Loadingpopup')}.hide();" execute="register_form" action="#{loginViewBean.register()}" value="register" render="Messagespopup"></a4j:commandButton></center></td>
        	</tr>
        </table>
	</rich:panel>
	</h:form>
	
	<ui:include src="MessagesComp.xhtml"/>

	<ui:include src="LoadingBoxComp.xhtml"/>

</body> 
</html>
